//
//  MyLoginViewController.m
//  weibo
//
//  Created by dllo on 16/6/15.
//  Copyright © 2016年 dllo. All rights reserved.
//

#import "MyLoginViewController.h"

@interface MyLoginViewController ()

@end

@implementation MyLoginViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    self.view.backgroundColor = [UIColor whiteColor];
    
    //添加背景图片
    UIImageView *backImageV = [[UIImageView alloc] initWithFrame:CGRectMake(0, 0, WIDTH, HEIGHT)];
    backImageV.image = [UIImage imageNamed:@"login_register_background"];
    [self.view addSubview:backImageV];
    [backImageV release];
    
    //返回按钮
    self.backButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.backButton.frame = CGRectMake(25, 45, 25, 25);
    [self.backButton setImage:[UIImage imageNamed:@"login_close_icon"] forState:UIControlStateNormal];
    [self.backButton addTarget:self action:@selector(backButtonAction) forControlEvents:UIControlEventTouchUpInside];
    [self.view addSubview:self.backButton];
    
    //注册按钮
    self.regiserButton = [UIButton buttonWithType:UIButtonTypeCustom];
    self.regiserButton.frame = CGRectMake(WIDTH - 110, 45, 85, 30);
//    self.regiserButton.backgroundColor = [UIColor yellowColor];
    self.regiserButton.titleLabel.textAlignment = NSTextAlignmentCenter;
    [self.regiserButton setTitle:@"注册用户" forState:UIControlStateNormal];
<<<<<<< HEAD
=======
<<<<<<< HEAD
=======
    [self.regiserButton addTarget:self action:@selector(regiserButtonAction) forControlEvents:UIControlEventTouchUpInside];
>>>>>>> 82817f7eab37fb5cfa32fd063c95557dd616f583
>>>>>>> d872c4ac8a140a3a6c8882d5c41110ef160d2a56
    [self.view addSubview:self.regiserButton];
    
    //注册TextF
    self.loginView = [[UIView alloc] initWithFrame:CGRectMake(0, 150, WIDTH * 2, 120)];
    [self.view addSubview:self.loginView];
    [self.loginView release];
    
    [self addImageView:0];
    [self addImageView:1];
    
    self.loginPhoneTextF = [self addTextField:@"手机号"];
    self.loginPhoneTextF.frame = CGRectMake(30, 20, WIDTH - 60, 30);
    
    self.loginPassWordTextF = [self addTextField:@"密码"];
    self.loginPassWordTextF.secureTextEntry = YES;
    self.loginPassWordTextF.frame = CGRectMake(30, 75, WIDTH - 60, 30);
    
    self.regiserPhoneTextF = [self addTextField:@"手机号"];
    self.regiserPhoneTextF.frame = CGRectMake(30 + WIDTH, 20, WIDTH - 60, 30);
    
    self.regiserPassWordTextF = [self addTextField:@"密码"];
    self.regiserPassWordTextF.frame = CGRectMake(30 + WIDTH, 75, WIDTH - 60, 30);
    self.regiserPassWordTextF.secureTextEntry = YES;
    
    
    // Do any additional setup after loading the view.
}

- (void)addImageView:(NSInteger )number{
    UIImageView *imageV = [[UIImageView alloc] initWithFrame:CGRectMake(20 + WIDTH * number, 0, WIDTH  - 40, 120)];
    imageV.image = [UIImage imageNamed:@"login_rgister_textfield_bg"];
    [self.loginView addSubview:imageV];
    [imageV release];
    
}

- (UITextField *)addTextField:(NSString *)text
{
    UITextField *textF = [UITextField new];
    textF.backgroundColor = [UIColor clearColor];
    textF.placeholder = text;
    [self.loginView addSubview:textF];
    return textF;
}

- (void)backButtonAction{
    [self dismissViewControllerAnimated:YES completion:^{
        
        
    }];
}


- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
